<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/mine_log.css">
    <link rel="stylesheet" href="/css/tabbar.css">
    <script src="/js/base.js"></script>
  </head>
  <body>
    <div class="mine_log">
      <img src="/assets/mine_log_bg.png" width="100%">
      <div class="tabs">
        <nav class="nav">
          <a href="javascript:;" data-cont="tab_pass">
            <span class="label">已通过</span>
          </a>
          <a href="javascript:;" data-cont="tab_fail">
            <span class="label">未通过</span>
          </a>
        </nav>
        <div class="cont" id="tab_pass">
          <div class="lesson">
            <div class="lesson_list">
              <div class="lesson_list_left">
                <h4>中凌太阳膜初级考试</h4>
                <div class="info"><span class="score">得分：95</span><span class="time">日期：2020-04-12</span></div>
              </div>
              <div class="lesson_list_right">
                <a href="">查看证书</a>
              </div>
            </div>
            <div class="lesson_list">
              <div class="lesson_list_left">
                <h4>中凌太阳膜初级考试</h4>
                <div class="info"><span class="score">得分：95</span><span class="time">日期：2020-04-12</span></div>
              </div>
              <div class="lesson_list_right">
                <a href="">查看证书</a>
              </div>
            </div>
          </div>
        </div>
        <div class="cont" id="tab_fail">
          <div class="lesson">
            <div class="lesson_list">
              <div class="lesson_list_left">
                <h4>中凌太阳膜初级考试</h4>
                <div class="info"><span class="score">得分：95</span><span class="time">日期：2020-04-12</span></div>
              </div>
              <div class="lesson_list_right">
                <a href="">继续学习</a>
              </div>
            </div>
            <div class="lesson_list">
              <div class="lesson_list_left">
                <h4>中凌太阳膜初级考试</h4>
                <div class="info"><span class="score">得分：95</span><span class="time">日期：2020-04-12</span></div>
              </div>
              <div class="lesson_list_right">
                <a href="">继续学习</a>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="tabbar">
        <div class="tabbar_cell">
          <div class="tabbar_icon home">
            <img src="/assets/tabbar_icon_home.png">
            <img src="/assets/tabbar_icon_home_active.png">
          </div>
          <div class="tabbar_name">首页</div>
        </div>
        <div class="tabbar_cell">
          <div class="tabbar_icon college">
            <img src="/assets/tabbar_icon_college.png">
            <img src="/assets/tabbar_icon_college_active.png">
          </div>
          <div class="tabbar_name">课程</div>
        </div>
        <div class="tabbar_cell active">
          <div class="tabbar_icon mine">
            <img src="/assets/tabbar_icon_mine.png">
            <img src="/assets/tabbar_icon_mine_active.png">
          </div>
          <div class="tabbar_name">我的</div>
        </div>
      </div>
    </div>
    <script>
			//默认显示一个当前的样式，点击导航实现切换
			function tabs(key){
				var navs=document.querySelectorAll('nav a');
				//遍历给导航绑定样式，并且添加样式
				for(var i=0;i<navs.length;i++){
					if(key==i){
						navs[i].classList.add('active');
						//拿到Id
						var secId=navs[i].dataset['cont'];
						//获取对应标签
						document.querySelector('#'+secId).style.display='block';
					}
					//绑定点击事件
					navs[i].addEventListener('click', function(){
						var currentNav=document.querySelector('.active');
						var currentId=currentNav.dataset['cont'];
						currentNav.classList.remove('active');
						document.querySelector('#'+currentId).style.display='none';
						
						this.classList.add('active');
						var myId=this.dataset['cont'];
						document.querySelector('#'+myId).style.display='block';
						
					})
				}
			}
			tabs(0);
		</script>
  </body>
</html>
